package com.example.test.启动线程.线程等待唤醒;

public class Notify {

    public static void main(String[] args) {


        class Not implements Runnable {

            @Override
            public void run() {
                synchronized (this) {
                    try {
                        this.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println("hello world");
                }
            }
        }

        Not not = new Not();
        new Thread(not).start();
        new Thread(not).start();
        new Thread(not).start();

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        synchronized (not) {
            not.notifyAll();
//            not.notify();
        }


    }
}
